import { TabBar } from 'antd-mobile'
import style from './index.less'
import {
  AppOutline,
  UnorderedListOutline,
} from 'antd-mobile-icons'
import { history } from '@/.umi/exports'
export default () => {
  const setRouteActive = (value: string) => {
    history.push(value)
  }
  const { pathname } = location

  const tabs = [
    {
      key: '/caigou',
      title: '供应大厅',
      icon: <AppOutline />
    },
    {
      key: '/dingdan',
      title: '交易订单',
      icon: <UnorderedListOutline />
    },
  ]
  return (
    <TabBar
      className={style.foolt}
      onChange={value => setRouteActive(value)}
      activeKey={pathname}
    >
      {tabs.map(item => (
        <TabBar.Item key={item.key} title={item.title} icon={item.icon} />
      ))}
    </TabBar>
  )
}
